package com.itheima.mapper;

import com.itheima.pojo.Option;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultMap;
import org.apache.ibatis.annotations.Select;

import java.util.List;

public interface OptionMapper {

    @Insert("insert into option_info values (null,#{surveyId},#{questionId},#{optionName},#{optionSort},#{optionPicId} )")
    @ResultMap("optionResultMap")
    void add(Option option);

    @Select("select * from option_info where question_id = #{questionId}")
    @ResultMap("optionResultMap")
    List<Option> selectAll(@Param("questionId") int questionId);
}
